package com.luoqiu.cinema.common;

import lombok.Data;

@Data
public class Result<T> {
    private static final Integer SUCCESS_CODE = 4000;

    private static final Integer FAIL_CODE = 4100;

    private static final Integer DENY_CODE = 4200;

    private String msg;

    private Integer code;

    private T data;

    public static<T> Result<T> success(T data) {
        Result<T> result = new Result<>();
        result.setCode(SUCCESS_CODE);
        result.setData(data);
        result.setMsg("success");
        return result;
    }

    public static Result<String> fail(String data) {
        Result<String> result = new Result<>();
        result.setCode(FAIL_CODE);
        result.setMsg("fail");
        result.setData(data);
        return result;
    }
}
